<template>
	<view>
		<view class="navigation-bar">
			<view @click="turnBack">
				<image src="/static/左箭头.png"></image>
			</view><text>导航</text>
		</view>
		<view class="background"></view>
		<view class="map1">
			<map style="width: 100%; height: 500px;" :latitude="latitude" :longitude="longitude" :markers="covers">
			</map>
			<view class="information">
				<view class="size">
					<view>车百事汽车生活馆</view>
					<view>山阳区人民路与解放路交叉口</view>
				</view>
				<view class="but">
					<button>导航</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: 0, // 使用 marker点击事件 需要填写id
				title: 'map',
				latitude: 39.909,
				longitude: 116.39742,
				covers: [{
					latitude: 39.909,
					longitude: 116.39742,
					iconPath: '../../../static/location.png'
				}, {
					latitude: 39.90,
					longitude: 116.39,
					iconPath: '../../../static/location.png'
				}]
			}
		},
		methods: {
			onMapTap(e) {
				console.log('地图被点击', e);
			},
			onMarkerTap(e) {
				console.log('标记点被点击', e);
			},
			turnBack() {
				uni.navigateBack({
					url: "/pages/index/index"
				})
			},
		}
	}
</script>

<style>
	.navigation-bar {
		position: relative;
		height: 150rpx;
		display: flex;
		align-items: center;
		background-color: #287BF6;
	}

	.navigation-bar>view>image {
		width: 30rpx;
		height: 30rpx;
		margin-left: 30rpx;
	}

	.navigation-bar>text {
		color: #FFF;
		margin-right: 40rpx;
		flex-grow: 1;
		text-align: center;
	}

	.background {
		position: absolute;
		background-color: #287BF6;
		width: 100%;
		height: 300rpx;
		z-index: 0;
	}

	.map1 {
		position: relative;
		margin: 20rpx;
		padding: 20rpx;
		border-radius: 20rpx;
		background-color: #FFF;
		z-index: 1;
	}

	.information {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.size {
		margin-top: 20rpx;
		margin-bottom: 20rpx;
	}

	.size>view:nth-child(1) {
		font-weight: bold;
		font-size: 32rpx;
		margin-bottom: 20rpx;
	}

	.but {
		margin-top: 20rpx;
	}

	.but>button {
		width: 180rpx;
		height: 80rpx;
		line-height: 80rpx;
		color: #FFF;
		background-color: #287BF6;
		border-radius: 40rpx;
	}
</style>